﻿using System.Linq;
using System.Collections.Generic;
using System.Web.Mvc;
using Citi.GocAttributes.Domain;
using Citi.GocAttributes.WebUI.Models;

namespace Citi.GocAttributes.WebUI.Controllers
{
    public class RuleResultController : ControllerBase<RuleResultModel, RuleResult>
    {
        public ActionResult Form(IEnumerable<RuleResultModel> models)
        {
            FillViewBag();
            return PartialView(models);
        }

        private void FillViewBag()
        {
            ViewBag.TypeRuleResults = new TypeRuleResult().SelectAllActive<TypeRuleResult>()
                                    .Select(x => new TypeRuleResultModel { Id = x.Id, Value = x.Value, Type = (DatabaseEnums.TypeResultType)x.Type })
                                    .OrderBy(x => x.Value);
        }
    }
}
